package com.findfuture.demo.model;

import javax.persistence.*;

/**
 * Created by IntelliJ IDEA.
 * User: Yanggang
 * Date: 11-11-17
 * Time: 下午2:59
 * To change this template use File | Settings | File Templates.
 */
@javax.persistence.Table(name = "images")
@Entity
public class Images {
    private int id;

    @javax.persistence.Column(name = "id", nullable = false, insertable = true, updatable = true, length = 10, precision = 0)
    @Id
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    private String url;

    @javax.persistence.Column(name = "url", nullable = true, insertable = true, updatable = true, length = 100, precision = 0)
    @Basic
    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    private String name;

    @javax.persistence.Column(name = "name", nullable = true, insertable = true, updatable = true, length = 50, precision = 0)
    @Basic
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private String thumb;

    @javax.persistence.Column(name = "thumb", nullable = true, insertable = true, updatable = true, length = 100, precision = 0)
    @Basic
    public String getThumb() {
        return thumb;
    }

    public void setThumb(String thumb) {
        this.thumb = thumb;
    }

    private String descript;

    @javax.persistence.Column(name = "descript", nullable = true, insertable = true, updatable = true, length = 5000, precision = 0)
    @Basic
    public String getDescript() {
        return descript;
    }

    public void setDescript(String descript) {
        this.descript = descript;
    }

    private int top;

    @javax.persistence.Column(name = "top", nullable = true, insertable = true, updatable = true, length = 11, precision = 0 )
    @Basic
    public int getTop() {
        return top;
    }

    public void setTop(int top) {
        this.top = top;
    }

    private float price;

    @javax.persistence.Column(name = "price", nullable = true, insertable = true, updatable = true, length = 12, precision = 0)
    @Basic
    public float getPrice() {
        return price;
    }

    public void setPrice(float price) {
        this.price = price;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Images images = (Images) o;


        if (id != images.id) return false;
        if (descript != null ? !descript.equals(images.descript) : images.descript != null) return false;
        if (url != null ? !url.equals(images.url) : images.url != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (url != null ? url.hashCode() : 0);
        result = 31 * result + (descript != null ? descript.hashCode() : 0);
        return result;
    }

    private Albums imageAlbum;

    @ManyToOne(fetch = FetchType.LAZY)
    @javax.persistence.JoinColumn(name = "album")
    public Albums getImageAlbum() {
        return imageAlbum;
    }

    public void setImageAlbum(Albums imageAlbum) {
        this.imageAlbum = imageAlbum;
    }
}
